/*
*hjc 20171125
*一句代码实现排序
*
*/

'use strict';

var arr = [10,20,1,2];

arr.sort((x,y)=>(x>y?1:(x===y?0:-1)));

console.log(arr);//[1,2,10,20]